
#ifndef LAYERDRAGGER_H
#define LAYERDRAGGER_H

#include <BMap>
#include "Operation.h"

class LayerDragger : public Operation
{
public:
	LayerDragger();
	~LayerDragger();

protected:
	void applyPartDraging(const BPoint& pos);

protected:
	void slotZoomChanged();
	void slotWidgetSelected(BObject* object, const BValue& value);

private:
	virtual void attached(BWidget* widget);
	virtual void detached(BWidget* widget);

	virtual void paint(BPainter& painter);
	virtual void update(double time);

	virtual void freshEvent(const BEvent& event);

	virtual bool focusEvent(const BEvent& event);
	virtual bool keyDownEvent(const BKeyEvent& keyEvent);
	virtual bool keyUpEvent(const BKeyEvent& keyEvent);

	virtual bool mouseEnterEvent(const BMouseEvent& mouseEvent);
	virtual bool mouseLeaveEvent(const BMouseEvent& mouseEvent);
	virtual bool mousePressEvent(const BMouseEvent& mouseEvent);
	virtual bool mouseReleaseEvent(const BMouseEvent& mouseEvent);
	virtual bool mouseMoveEvent(const BMouseEvent& mouseEvent);

	virtual bool mouseWheelEvent(const BMouseEvent& mouseEvent);

private:
	BPoint				_dragPoint;
	bool				_draging;
	Part				_dragPart;
	BMap<PartFlag, BRect>	_dragRectMap;
	BArray<BRect>		_dragInitialRects;
	bool				_dirtySelection;

};

#endif
